package org.springframework.study;


import org.springframework.context.annotation.*;

import java.time.ZoneId;

@Configuration
@ComponentScan
public class ProfileTest {
	@Bean("zoneId")
	@Profile("test")
	ZoneId createZoneId() {
		return ZoneId.systemDefault();
	}

	@Bean("zoneId")
	@Profile("!test")
	ZoneId createZoneIdForTest() {
		return ZoneId.of("America/New_York");
	}

	public static void main(String[] args) {

		AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext(ProfileTest.class);

		ZoneId zoneId = (ZoneId) context.getBean("zoneId");
		System.out.println(zoneId);
	}
}
